import request from '@/utils/request'

export function listDataset() {
  return request({
    url: "/model/listDataset.action",
    method: 'get'
  });
}

export function listTables(dsid, tname) {
  return request({
    url: `/model/listTables.action?dsid=${dsid}&tname=${tname}`,
    method: 'get'
  });
}

export function listTableColumns(dsid, tname) {
  return request({
    url: `/model/listTableColumns.action?dsid=${dsid}&tname=${tname}`,
    method: 'get'
  });
}

export function queryDatasetMeta(cfg, dsid) {
  return request({
    url: `/model/queryDatasetMeta.action?dsid=${dsid}`,
    method: 'post',
    data: cfg
  });
}

export function queryDataset(dsetId, dsid) {
  return request({
    url: `/model/queryDataset.action?dsid=${dsid}&dsetId=${dsetId}`,
    method: 'get'
  });
}

export function updateDset(dset) {
  return request({
    url: `/model/updateDset.action`,
    method: 'post',
    data: dset
  });
}

export function saveDset(dset) {
  return request({
    url: `/model/saveDset.action`,
    method: 'post',
    data: dset
  });
}

export function getDatasetCfg(dsetId) {
  return request({
    url: `/model/getDatasetCfg.action?dsetId=${dsetId}`,
    method: 'get'
  });
}

export function deleteCfg(dsetId) {
  return request({
    url: `/model/deleteDset.action?dsetId=${dsetId}`,
    method: 'get'
  });
}

export function reloadDset(dsetId, dsid) {
  return request({
    url: `/model/reloadDset.action?dsid=${dsid}&dsetId=${dsetId}`,
    method: 'get'
  });
}
